package controllers;

import java.util.List;

import models.User;
import models.blog.Post;
import play.mvc.Controller;
import play.mvc.With;

/**
 * 
 * @author sile
 * 
 */
public class Blog extends Controller {

	public static void index() {
		List<Post> posts = Post.findAll();
		render(posts);
	}

	public static void addComment(Post post, User author, String comment) {
		post.addComment(author.screenName, comment);
		show(post.id);
	}

	public static void show(long id) {
		render(Post.find("byId", id));
	}
}
